package com.example.arithmeticleetcode.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: arithmetic-leetcode
 * @description: 1374. 生成每种字符都是奇数个的字符串
 * @author: FangZhen
 * @create: 2020-04-22 18:49
 **/
public class Demo06 {

    public static void main(String[] args) {
        Character character = (char) 98;
        System.out.println(character);
    }

    public String generateTheString(int n) {
        StringBuffer sb = new StringBuffer(n);
        char a = 'a';
        char b = 'b';
        //如果是偶数
        if (n % 2 == 0) {
            for (int i = 0, len = n - 1; i < len; i++) {
                sb.append(a);
            }
            sb.append(b);
        }
        //如果是奇数
        if (n % 2 == 1) {
            for (int i = 0, len = n; i < len; i++) {
                sb.append(a);
            }
        }
        return sb.toString();
    }
}
